<template>
    <div class="div_main_frame" style="text-align:center;margin:0 auto;margin-top:0px;padding-top:0px;" align="center">
        
    <div class="fastweb_div_middle" style="width:100%;min-height:200px;text-align:center;margin-top:0px;padding-top:0px;">

        <div class="div_page_top_middle" style="width:90%;height:auto;margin:0 auto;padding:0;text-align:center;">
          <div v-if="this.entity_name" style="font-size:32px;line-height:48px;text-align:center;">{{this.entity_name}}</div>
          <div v-if="this.custom_word" style="font-size:18px;line-height:40px;text-align:center;">关键词：{{this.custom_word}}</div>
          <div v-if="this.start_date" style="font-size:18px;line-height:40px;text-align:center;">时间：{{this.start_date}}至{{this.task_date}}</div>
          <div v-for="(d, index) in this.json_task_detail" :key="index" style="text-align:left;border-bottom:6px solid #FFFFFF;background-color:#F5F5F6;padding-left:6px;border-radio:3px;">
            <a :href="d.data_url" target="_blank"><p><font color="blue">{{d.data_title}}</font></p><p>[{{d.data_site}}][{{d.data_date}}]</p></a>
            <!--router-link :to="{name:'result', query:{entity_name:d.entity_name,task_id:d.task_id}}"><p>实体集:{{d.entity_name}}</p><p v-if="d.custom_word">关键词:{{d.custom_word}}</p><p>日期:{{d.start_date}}~{{d.task_date}}</p></router-link-->
          </div>
          
          <!--ol class="fastweb_tree" style="padding:0;margin:0">
          <li  class="fastweb_tree_nav"><input type="checkbox" class="fastweb_tree_input" checked="checked"/><ol>
            <li v-for="(d, index) in this.json_task_detail" :key="index" style="width:100%;float:left;text-align:left;background-color:#FFFFE0" class="fastweb_tree_leaf">
              <a :href="d.data_url" target="_blank"><p>[{{d.data_site}}][{{d.data_date}}]</p><p>{{d.data_title}}</p></a>
            </li>
          </ol></li>
          </ol-->
        </div>
        <div style="clear:both"></div>
    </div>
    </div>
    
    <ViewFooter/>
</template>

<script>
import { reactive,toRefs,watch,ref } from 'vue'
import { getCurrentInstance } from 'vue'
import ViewFooter from '@/components/ViewFooter.vue'
import "@/assets/global.css"
import "@/assets/fastweb.css"

const size = ref('default')
const labelPosition = ref('top')

export default 
{
    name: 'PageResult',
    components: {
        ViewFooter
    },

    data () {
      return {
        entity_name:"",
        custom_word:"",
        start_date:"",
        task_date:"",
        json_task_detail: [],
        param: {},
      };
    },
    setup(){
      const host = getCurrentInstance()?.appContext.config.globalProperties.host
      //entity_list_url = host + ""
      return {host};
        
    },
    methods: {
      queryTaskDetail:function() {
        let data = new FormData();
        data.append("task_id", this.param["task_id"]);
        data.append("entity_name", decodeURIComponent(this.param["entity_name"]));
        console.log(this.param["task_id"]);
        console.log(this.param["entity_name"]);
        
        var api_url = this.host.concat("/api/display_task_detail")
        this.axios.post(api_url, data).then(response => {
          if((response.status == 200) && (response.data.result == 0)){
            this.json_task_detail = JSON.parse(response.data.data);
          }
        })
        .catch(error => alert("系统错误，请稍后重试"));
      }
    },
    mounted() {
      console.log(window.location.href);
      var url = window.location.href;             //获取当前url
      var cs = url.split('?')[1];                //获取?之后的参数字符串
      var cs_arr = cs.split('&');                    //参数字符串分割为数组
      this.param = {};
      for(var i=0;i<cs_arr.length;i++){         //遍历数组，拿到json对象
        this.param[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1];
      }
      this.entity_name = decodeURIComponent(this.param["entity_name"]);
      this.custom_word = decodeURIComponent(this.param["custom_word"]);
      this.start_date = this.param["start_date"];
      this.task_date = this.param["task_date"];
      this.queryTaskDetail();
    },
    watch:{
    },
}

var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c2ba86525ff37a3b2dd6cdadb129fdb5";
var s = document.getElementsByTagName("script")[0]; 
s.parentNode.insertBefore(hm, s);
</script>

<style>

.dingzhi_tile {
    text-align:left;
    padding-left:30px;
    line-height:50px;
    font-size: 24px;
    border-top:1px solid #009100;
    /*border-bottom:1px dashed #009100;*/
}


.search_menu {
  background-color: gold;
  top:40px;
  width:100%;
  height:auto;
  border:1ps solid blue;
  position: absolute;
  text-align: left;
  z-index: 10;
}

.search_menu ul{
  margin-bottom: 0;
  list-style-type: none;
}

.search_menu li {
  padding: 5px;
  font-size: 1.1em;
  cursor: pointer;
}

.search_menu li:hover {
  background-color: beige;
}

.search:hover .search_menu {
  display: block;
}


</style>

<style scoped>
a {
    /*background-color: #409EFF;*/
    color:#303133;
    /*font-family: Arial,Verdana,Sans-serif;*/
    font:14px arial,sans-serif;
    line-height:30px;
}
</style>
